﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/OnlyAuthenticated/GeneratorMasterPage.master" Inherits="OnlyAuthenticated_OnlyManagers_EditUseri" Codebehind="EditUseri.aspx.cs" %>


<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="GeneratorPageContent">

    <h2>
        Useri
    </h2>

    <h3>Vizualizare, Editare, Stergere, Activare/Dezactivare Useri</h3>
<p>&nbsp;</p>

<asp:GridView ID="GridView1" runat="server" AllowSorting="True" DataSourceID="UsersSqlDataSource" 
        AutoGenerateColumns="False" Width="780px" DataKeyNames="UserName"><%-- ,RoleName,Email,IsApproved,Comment--%>
    <Columns>
        <asp:BoundField DataField="UserName" HeaderText="User" 
            SortExpression="UserName" ReadOnly="True" >
            <ControlStyle Width="150px" /><ItemStyle Width="150px" />
            </asp:BoundField>
        <asp:BoundField DataField="RoleName" HeaderText="Rol" 
            SortExpression="RoleName" >
            <ItemStyle Width="70px" /><ControlStyle Width="70px" />
            </asp:BoundField>
        <asp:BoundField DataField="Email" HeaderText="Email"
            SortExpression="Email" >
            <ControlStyle Width="98%" /><ItemStyle Width="200px" />
            </asp:BoundField>
        <asp:CheckBoxField DataField="IsApproved" HeaderText="Activ" 
            SortExpression="IsApproved"  >
            <ControlStyle Width="98%" /><ItemStyle Width="20px" HorizontalAlign="Center" />
            </asp:CheckBoxField>
        <asp:BoundField DataField="Comment" HeaderText="Comentarii" 
            SortExpression="Comment" >
            <ControlStyle Width="98%" /><ItemStyle Width="150px" />
            </asp:BoundField>
        <asp:BoundField DataField="CreateDate" HeaderText="DataCrearii" 
            SortExpression="CreateDate" ReadOnly="True" >
            <ControlStyle Width="50px" /><ItemStyle Width="80px" HorizontalAlign="Center" />
            </asp:BoundField>
        <asp:BoundField DataField="LastLoginDate" HeaderText="UltimulLogin" 
            SortExpression="LastLoginDate" ReadOnly="True" >
            <ControlStyle Width="80px" /><ItemStyle Width="80px" HorizontalAlign="Center" />
            </asp:BoundField>
        <asp:CommandField DeleteText="Sterge" ShowDeleteButton="True" 
            ShowEditButton="True" UpdateText="OK" />
    </Columns>
    <EditRowStyle Width="780px" Wrap="False" />
</asp:GridView>

    <asp:SqlDataSource ID="UsersSqlDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:UsersConnectionString %>" 

        DeleteCommand="BjDeleteUser" DeleteCommandType="StoredProcedure" 
        SelectCommand="SELECT aspnet_Users.UserName, aspnet_Users.UserId, aspnet_Roles.RoleName, aspnet_Membership.Email, aspnet_Membership.IsApproved, aspnet_Membership.CreateDate, aspnet_Membership.LastLoginDate, aspnet_Membership.Comment FROM aspnet_Users INNER JOIN aspnet_UsersInRoles ON aspnet_Users.UserId = aspnet_UsersInRoles.UserId INNER JOIN aspnet_Roles ON aspnet_UsersInRoles.RoleId = aspnet_Roles.RoleId INNER JOIN aspnet_Membership ON aspnet_Users.UserId = aspnet_Membership.UserId" 
        UpdateCommand="BjUpdateUser" UpdateCommandType="StoredProcedure">

        <DeleteParameters>
            <asp:Parameter Name="ApplicationName" Type="String" DefaultValue="/" />
            <asp:Parameter Name="UserName" Type="String" DefaultValue="/" />
            <%--<asp:ControlParameter ControlID="GridView1" Name="UserName" 
                PropertyName="SelectedValue" Type="String" />
           --%> <asp:Parameter Name="TablesToDeleteFrom" Type="Int32" DefaultValue="15" />
        </DeleteParameters>

        <UpdateParameters>
            <asp:Parameter Name="ApplicationName" Type="String" DefaultValue="/" />
            <asp:Parameter Name="UserName" Type="String" />
            <asp:Parameter Name="RoleName" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="IsApproved" Type="Boolean" />
            <asp:Parameter Name="Comment" Type="String" />
<%--            <asp:ControlParameter ControlID="GridView1" Name="UserName" 
                PropertyName="SelectedValue" Type="String" />

            <asp:ControlParameter ControlID="GridView1" Name="RoleName" 
                PropertyName="SelectedValue" Type="String" />

            <asp:ControlParameter ControlID="GridView1" Name="Email" 
                PropertyName="SelectedValue" Type="String" />

            <asp:ControlParameter ControlID="GridView1" Name="IsApproved" 
                PropertyName="SelectedValue" Type="String" />

            <asp:ControlParameter ControlID="GridView1" Name="Comment" 
                PropertyName="SelectedValue" Type="String" />--%>


        </UpdateParameters>
    </asp:SqlDataSource>

<%--    <asp:SqlDataSource ID="UsersSqlDataSource" runat="server" 
  
        
        ConnectionString="<%$ ConnectionStrings:UsersConnectionString %>" 
        DeleteCommand="exec aspnet_Users_DeleteUserBj '/', [UserName] = @UserName, 15"
        SelectCommand="SELECT aspnet_Users.UserName, aspnet_Users.UserId, aspnet_Roles.RoleName, aspnet_Membership.Email, aspnet_Membership.IsApproved, aspnet_Membership.CreateDate, aspnet_Membership.LastLoginDate, aspnet_Membership.Comment FROM aspnet_Users INNER JOIN aspnet_UsersInRoles ON aspnet_Users.UserId = aspnet_UsersInRoles.UserId INNER JOIN aspnet_Roles ON aspnet_UsersInRoles.RoleId = aspnet_Roles.RoleId INNER JOIN aspnet_Membership ON aspnet_Users.UserId = aspnet_Membership.UserId" 
        UpdateCommand="UPDATE aspnet_Membership SET Email =, IsApproved =, Comment = FROM aspnet_Membership INNER JOIN aspnet_Users ON aspnet_Membership.UserId = aspnet_Users.UserId INNER JOIN aspnet_UsersInRoles ON aspnet_Users.UserId = aspnet_UsersInRoles.UserId INNER JOIN aspnet_Roles ON aspnet_UsersInRoles.RoleId = aspnet_Roles.RoleId">
        
        <deleteparameters>
            <asp:Parameter Name="UserName" Type="String" />
        </deleteparameters>
          
    </asp:SqlDataSource>--%>

</asp:Content>

